@using Elsa.Api.Client.Shared.UIHints.DropDown
@inject ILocalizer Localizer

@{
    var inputDescriptor = EditorContext.InputDescriptor;
    var displayName = inputDescriptor.DisplayName;
    var description = inputDescriptor.Description;
    var selectedValue = GetSelectedValue();
    var searchBox = _items.Count > 10;
}

<FieldExtension UIHintComponent="@InputUIHints.OutputPicker" EditorContext="@EditorContext">
    <ChildContent>
        <MudSelectExtended T="SelectListItem"
                           Label="@Localizer[displayName]"
                           Variant="Variant.Outlined"
                           HelperText="@Localizer[description]"
                           Margin="Margin.Dense"
                           Value="@selectedValue"
                           SearchBox="@searchBox"
                           ItemCollection="@_items"
                           ToStringFunc="@(item => item?.Text ?? "")"
                           ValueChanged="OnValueChanged"
                           ReadOnly="EditorContext.IsReadOnly"
                           Disabled="EditorContext.IsReadOnly">
        </MudSelectExtended>
    </ChildContent>
</FieldExtension>